# demo11_game2.py
### 练习 1：完善石头剪刀布的游戏
# 实现循环结构，要求游戏三局两胜  2 3 while
import random
all_choices = ["shitou", "jiandao", "bu"]
win_list = [  # 玩家获胜的情况
    ["shitou", "jiandao"], ["jiandao", "bu"], ["bu", "shitou"]
]
p_win = 0  # 玩家获胜的次数
c_win = 0  # 计算机获胜的次数
while p_win < 2 and c_win < 2:
    computer = random.choice(all_choices)  # 随机出拳
    print("computer:", computer)
    player = input("shitou/jiandao/bu: ")
    if computer == player:
        print("平局")
    elif [player, computer] in win_list:
        print("player win~")
        p_win += 1
    else:
        print("computer win~")
        c_win += 1
